/**
 * @Title: MultipleDataSource
 * @Package cn.com.artemis.company.portal.config
 * @Description: TODO
 * Copyright: Copyright (c) 2016
 * Company: 成都壹柒互动科技有限公司
 * @author 会员系统组-胥钰淋
 * @date 2016/12/22 11:55
 * @version V1.0
 */
package cn.com.yiqi.wsc.config;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 *
 *@ClassName: MultipleDataSource
 * @Description: TODO
 * @author 会员系统组-胥钰淋
 * @date 2016/12/22 11:55
 *
 */
public class MultipleDataSource extends AbstractRoutingDataSource {

    private static final ThreadLocal<String> dataSourceKey = new InheritableThreadLocal<String>();

    public static void setDataSourceKey(String dataSource) {
        dataSourceKey.set(dataSource);
    }

    @Override
    protected Object determineCurrentLookupKey() {
        return dataSourceKey.get();
    }
}